# -*- coding: utf-8 -*-
# @Time        :2025/4/17 16:33
# @Author      :文刀水寿
# @File        : urls.py
"""
 @Description :
"""
from fastapi import APIRouter
from pydantic import BaseModel, EmailStr
from typing import Union, List

app8 = APIRouter()


class UserIn(BaseModel):
    username: str
    password: str
    email: EmailStr
    full_name: Union[str, None] = None


class UserOut(BaseModel):
    username: str
    email: EmailStr
    full_name: Union[str, None] = None


items = {
    "foo": {"name": "LT", "price": 50.00}
}


class Items(BaseModel):
    name: str
    description: Union[str, None] = None
    price: float
    tax: float = 10.5
    tags: List[str] = []


@app8.post('/zhuce', response_model=UserOut)
async def create_zhuce(zhuce: UserIn):
    # 存到数据库
    return zhuce


@app8.get('/items/{item_id}', response_model=Items, response_model_exclude_none=True)
async def Items(item_id: str):
    # 存到数据库
    return items[item_id]
